package com.wanjia.estate.pojo.model;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * Json格式的数据进行响应
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class JsonResult<E> {
    /*状态码*/
    private Integer code;
    /*描述信息*/
    private String message;
    /*数据*/
    //@JsonInclude(NON_NULL)
    private E data;

    public JsonResult(Integer code) {
        this.code = code;
        this.message="";
    }

    public JsonResult(Throwable e) {
        this.message = e.getMessage();
    }

    public JsonResult(Integer code, E data) {
        this.code = code;
        this.data = data;
    }

}
